﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AdministracijaClanaka : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        porukaOdodavanjuClanka.InnerText = "";
    }
    protected void btnDodajClanak_Click(object sender, EventArgs e)
    {

        AdministracijaUtility u = new AdministracijaUtility();
        try
        {
            u.DodajClanak(txtNazivClanka.Text, ftbClanakODrvetu.Text,Int32.Parse( ddlDodavanjeClanakaNazivPoglavlja.SelectedValue), Int32.Parse(ddlNazivGalerije.SelectedValue));
          
        }
        catch (Exception ex)
        {
            porukaOdodavanjuClanka.InnerText  = ex.Message;
        }
        OsvjeziPodatke();
        porukaOdodavanjuClanka.InnerText  = "Članak uspješno dodan u bazu";
    }

    protected void OsvjeziPodatke()
    {
        sdsClanci.DataBind();
        sdsClanciGalerija.DataBind();
        sdsClanciPoglavlje.DataBind();
        grdClanci.DataBind();
    }
}